RegEx.Search Function

Finds SearchPattern in TargetString, beginning at SearchStartPosition. If it succeeds, it returns a RegExMatch.

Syntax

result = RegEx.Search( [TargetString], [SearchStartPosition] )

Parameters

TargetString

String (Optional)

SearchStartPosition

Integer (Optional)

Return Value

Result

RegExMatch

Notes

Both parameters are optional; if TargetString is omitted, it assumes the previous TargetString, so you will want to pass a TargetString the first time you call Search. If you call Search with a TargetString and omit SearchStartPosition, zero is assumed. If you call Search with no parameters after initially passing a TargetString, it assumes the previous TargetString and will begin the search where it left off in the previous call. This is the easiest way to find the next occurrence of SearchPattern in TargetString.

The RegExMatch will remember the ReplacementPattern specified at the time of the search.